#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
 @file name: serializers.py
 @desc:
 @author: xu wang
 @mail: jason_wangxu@163.com
 @date: 2025/1/5 12:00
"""
from rest_framework.relations import StringRelatedField
from rest_framework.serializers import ModelSerializer

from Cronjob.models import CronJob


class CronJobSerializer(ModelSerializer):
    task_name = StringRelatedField(read_only=True, source="task.name")
    env_name = StringRelatedField(read_only=True, source="env.name")

    class Meta:
        model = CronJob
        fields = "__all__"
